package ningbo.file;

import java.io.*;

/**
 * @Author 宁铂
 * @Date 2021/7/18 22:40
 * @Version 1.0
 */
public class TestIn2 {
    /** 本类用于测试字符流的读取 */
    public static void main(String[] args) {
        //method1();
        method2(


        );
    }

    private static void method2() {
        Reader in = null;
        try {
            in = new BufferedReader(new FileReader("F:\\TestFile\\1.txt"));

            int b;
            while ((b = in.read()) != -1){
                System.out.println(b);
            }
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    private static void method1() {
        Reader in = null;
        try {
            in = new FileReader("F:\\TestFile\\1.txt");

            int b;
            while ((b = in.read()) != -1){
                System.out.println(b);
            }
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
